package logic.regulardevices;

import java.util.ArrayList;

public class FireAlarm extends RegularDevice {

	private boolean on;
	
	public FireAlarm() {
		id = "fa";
	}
	
	@Override
	public String receiveAndRespond(String cmd) {
		if(cmd.equals("on")) {
			return turnOn();
		} else if(cmd.equals("off")) {
			return turnOff();
		} else if(cmd.equals("check")) { //checks the firealarms state.
			return check();
		}
		return invalidCommand();
	}
	
	private String turnOn() {
		on=true;
		return "on";
	}
	private String turnOff() {
		on=false;
		return "off";
	}
	
	@Override
	public String check() {
		if(on)
			return "on";
		return"off";
	}

	@Override
	public String test() {
		// TODO Auto-generated method stub
		return null;
	}

}
